package com.mmlc.meimei.lichengkongjian.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.mmlc.meimei.lichengkongjian.R;
import com.mmlc.meimei.lichengkongjian.been.SendTraceBean;

import java.util.List;

public class SendTraceAdapter extends BaseAdapter {

    ViewGroup viewGroup;
    List<SendTraceBean.TraceBean> item;
    Context context;

    public SendTraceAdapter(Context context,ViewGroup viewGroup, List<SendTraceBean.TraceBean> item) {
        this.viewGroup = viewGroup;
        this.item = item;
        this.context = context;
    }

    @Override
    public int getCount() {
        return item.size();
    }

    @Override
    public Object getItem(int i) {
        return item.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(final int i, View view, ViewGroup viewGroup) {
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.adapter_send_shop_trace, viewGroup, false);
        }
        ImageView ivPoint = null;
        ivPoint = (ImageView) view.findViewById(R.id.iv_point);
        if(i == 0){
            ivPoint.setImageResource(R.drawable.quan1);
        }else{
            ivPoint.setImageResource(R.drawable.quan2);
        }
        SendTraceBean.TraceBean bean = item.get(i);

        TextView tv_title = (TextView) view.findViewById(R.id.title);
        tv_title.setText(bean.desc);

        TextView tv_time = (TextView) view.findViewById(R.id.time);
        tv_time.setText(bean.time);
        return view;
    }
}

